﻿using System;
using System.Collections; 
using System.Collections.Specialized;  

namespace Parseq.Compiler
{
    public class BaseExp
    {
        private string type;
        public BaseExp(string type)
        {
            this.type = type; 
        }
        public string Type
        {
            get { return this.type; }
        }
        public bool Isa(string type)
        {
            return this.type == type; 
        }
    }

    public class Token : BaseExp 
    {
        private object val;

        public Token(string type, object val) : base(type) 
        {
            this.val = val;
        }

        public object Value
        {
            get { return this.val; }
        }

        public override string ToString()
        {
            string inner = this.val is object[] ? Util.String.ArrayToString((object[])this.val) : this.val.ToString();
            return string.Format("{{#{0}:{1}}}", this.Type, inner);
        }
    }

}
